<template>
	<view class="container">
		<view class="f-item">
			<view class="label">
				在职时间
			</view>
			<view class="select-box">
				<view class="start-time" @click="openSelect(1)">
					<text v-if="startTime" class="val">{{startTime}}</text>
					<text v-else class="pla-class">入职时间</text>
				</view>
				<text>-</text>
				<view class="end-time" @click="openSelect(2)">
					<text v-if="endTime" class="val">{{endTime}}</text>
					<text v-else class="pla-class">离职时间</text>
				</view>
			</view>
		</view>
		<view class="f-item">
			<view class="label">
				工作内容
			</view>
			<view class="textarae-box">
				<textarea placeholder="工作内容" placeholder-class="pla-class"></textarea>
				<text>0/500</text>
			</view>
		</view>
		
		<view class="display-flex center margin-top-60" style="padding: 0 22rpx;box-sizing: border-box;">
			<view class="button" style="width: 100%;height: 96rpx;line-height: 96rpx;font-size: 32rpx;text-align: center;">
				确定
			</view>
		</view>
		
		<dateYearMouth ref="time" title="参加工作时间" dateType="experience" :dateValueStr="times" @change="selectDate"></dateYearMouth>
	</view>
</template>

<script>
	import popupBox from '@/components/popup/popup.vue'
	import dateYearMouth from '@/components/popup-picker/date-year-mouth.vue'
	// import popupPicker from '@/components/popup-picker/popup-picker.vue';
	export default {
		components:{
			// popupPicker,
			popupBox,
			dateYearMouth
		},
		data() {
			return {
				startTime:'',
				endTime:'至今',
				times:'',
				type:null,
			};
		},
		methods:{
			selectDate(val){
				console.log(val)
				if(this.type==1){
					this.startTime = val
				}else{
					this.endTime = val
				}
			},
			openSelect(type){
				this.type = type
				if(type==1){
					this.times = this.startTime
				}else{
					this.times = this.endTime
				}
				this.$refs.time.open()
				setTimeout(()=>{
					this.$refs.time.initDate()
				}, 10);
			}
		}
	}
</script>
<style>
	page{
		background-color: #FFFFFF;
	}
</style>
<style lang="scss" scoped>
.container{
	.f-item{
		padding: 0 22rpx;
		box-sizing: border-box;
		&:nth-child(1){
			border-bottom: 2rpx solid #EEEEEE;
		}
		.label{
			font-weight: bold;
			font-size: 36rpx;
			color: #000000;
			line-height: 50rpx;
			margin-top: 40rpx;
		}
		
		.select-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 22rpx 0;
			margin-top: 18rpx;
			&>text{
				font-weight: 400;
				font-size: 36rpx;
				color: #000000;
				line-height: 50rpx;
			}
			&>view{
				width: calc(50% - 80rpx);
				.pla-class{
					font-weight: 400;
					font-size: 36rpx;
					color: #B4B4B4;
					line-height: 50rpx;
				}
				.val{
					font-weight: 400;
					font-size: 36rpx;
					color: #000000;
					line-height: 50rpx;
				}
			}
		}
		
		.textarae-box{
			width: 100%;
			height: 462rpx;
			background: #F5F5F5;
			border-radius: 20rpx;
			margin-top: 22rpx;
			textarea{
				width: 100%;
				height: 100%;
				padding: 28rpx;
				box-sizing: border-box;
			}
			position: relative;
			&>text{
				position: absolute;
				bottom: 24rpx;
				right: 34rpx;
				font-weight: 400;
				font-size: 32rpx;
				color: #727272;
				line-height: 44rpx;
			}
		}
	}
}
</style>
